package com.token.sysflow.hander;

import com.token.base.Pl;
import com.token.sql.IntegrateSql;
import com.token.sql.TableBeanPrepareSql;
import com.token.sysapp.bean.FSysAppInfo;

import java.sql.ResultSet;
import java.sql.SQLException;

/**
 * @author chenjianxiong 2020/4/28
 */
public class AppInfo extends FSysAppInfo {
    TableBeanPrepareSql tSql;

    private boolean isHas = false;

    public boolean isHas(){
        return isHas;
    }
    /**
     * 应用Id初始化。
     * @param f
     * @param appKeyId
     * @throws Exception
     */
    public AppInfo(IntegrateSql f,String appKeyId) throws Exception {
        super(f);
        tSql = new TableBeanPrepareSql(this);
        tSql.setSelectPrepare("SysId=? and AppKeyId=?");
        tSql.setPstValue(1, Pl.getSysId());
        tSql.setPstValue(2,appKeyId);
        ResultSet rs = tSql.executeQuery();
        if(rs.next()){
            this.initParamToRs(rs);
            isHas = this.isInitRs();
        }
        rs.close();
    }

    public void close(){
        try {
            super.close();

        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        tSql.close();
    }


}
